#include <iostream>
using namespace std;

const int N = 101;

int main()
{
    int a[N];
    int n, i, max, min;

    while (cin >> n)
    {
        max = -1, min = 101;

        for (i = 1; i <= n; i++)
        {
            cin >> a[i];
            if (a[i] > max)
                max = a[i];
            if (a[i] < min)
                min = a[i];
        }

        cout << max << " " << min << endl;
    }
    return 0;
}